AC_INIT([liblich],[0.0.1])
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
AC_DEFINE_UNQUOTED([LICH_CONFIG_PATH], ["${sysconfdir}"], [define lich prefix path])
AC_CONFIG_HEADERS([include/config.h])

AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_LIBTOOL
AC_PROG_INSTALL

AM_MAINTAINER_MODE([enable])

case $target_os in
    *linux*)    arch=linux;;
    *bsd*)      arch=bsd;;
    *)          arch=unknown;;
esac

if test "$ac_env_CFLAGS_set" != set; then
    CFLAGS="-Wall -W -g"
fi

CPPFLAGS="$CPPFLAGS -W -Wall -D_GNU_SOURCE -D_REENTRANT "

LIBS="-lpthread"

AC_CHECK_FUNCS([pthread_rwlock_init])


subdirs=" \
       include \
       build \
       "

AC_SUBST(subdirs)

AM_CONDITIONAL(LINUX, test "$arch" = linux)
AM_CONDITIONAL(BSD, test "$arch" = bsd)

AC_CONFIG_FILES([ \
        include/Makefile \
        build/Makefile \
	])

AC_OUTPUT
